package leetcode.part1;

import org.junit.Test;

import java.util.Arrays;

public class S2 {
    @Test
    public void test(){
        int[] nums={0,1,2,2,3,0,4,2};
        int val=2;
        int[] nums1={2};
        int val1=3;
        System.out.println(removeElement(nums, val));

    }
    public int removeElement(int[] nums, int val) {

      int left=0;
      int right=0;

      for (;right<nums.length;right++){
          if (nums[right]!=val){
              nums[left]=nums[right];
              left++;
          }
      }
      return left;
    }
}
